﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BDPAutodetect.Models
{
    public class MRolePower
    {
        /// <summary>
        /// 角色实例
        /// </summary>
        public MRoleDto Role { get; set; }
        /// <summary>
        /// 权限集合
        /// </summary>
        public List<MPowerPermission> Powers { get; protected set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="argRole"></param>
        public MRolePower(MRoleDto argRole)
        {
            this.Role = argRole;
            this.Powers = new List<MPowerPermission>();
        }

        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="argPower"></param>
        public void AddPower(MPowerPermission argPower)
        {
            if (argPower == null) return;
            if (this.Powers == null) Powers = new List<MPowerPermission>();
            this.Powers.Add(argPower);
        }
    }
}
